import Vue from 'vue'
import VueRouter from 'vue-router'
// 加载一级路由组件
import Layout from '@/views/Layout'
import Play from '@/views/play'
// 加载二级路由组件
import Home from '@/views/home'
import Search from '@/views/search'
Vue.use(VueRouter)

const routes = [{
  path: '/',
  component: Layout,
  redirect: '/home', // 默认访问首页
  children: [{
      path: '/home',
      component: Home,
      meta: { // meta保存路由对象额外信息的
        title: '首页'
      }
    },
    {
      path: '/search',
      component: Search,
      meta: { // meta保存路由对象额外信息的
        title: '搜索'
      }
    }
  ]
}, {
  path: '/play',
  component: Play
}]

const router = new VueRouter({
  routes
})

export default router
